

<!DOCTYPE html>
<html lang="zh-CN" data-default-color-scheme=auto>



<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/img/favicon.png">
  <link rel="icon" href="/img/favicon.png">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="author" content="Fly542">
  <meta name="keywords" content="">
  
    <meta name="description" content="一、 Linux 版从 dockerfile 制作 Docker 镜像制作linux版的docker镜像需要一些准备工作，然后编写对应的dockerfile， 执行dockerfile 、推送镜像到服务端 1. 准备工作1.1 准备好可访问外网的虚拟机，并安docker等软件12345678# 安装yum install -y dockeryum install -y git# 启动systemc">
<meta property="og:type" content="article">
<meta property="og:title" content="docker镜像制作并上传">
<meta property="og:url" content="http://fly542.cn/2023/12/06/04DevOps/30docker%E9%95%9C%E5%83%8F%E5%88%B6%E4%BD%9C%E5%B9%B6%E4%B8%8A%E4%BC%A0/index.html">
<meta property="og:site_name" content="Fly542 技术沉淀">
<meta property="og:description" content="一、 Linux 版从 dockerfile 制作 Docker 镜像制作linux版的docker镜像需要一些准备工作，然后编写对应的dockerfile， 执行dockerfile 、推送镜像到服务端 1. 准备工作1.1 准备好可访问外网的虚拟机，并安docker等软件12345678# 安装yum install -y dockeryum install -y git# 启动systemc">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2023-12-06T07:59:33.000Z">
<meta property="article:modified_time" content="2023-12-06T08:14:24.847Z">
<meta property="article:author" content="Fly542">
<meta property="article:tag" content="linux">
<meta name="twitter:card" content="summary_large_image">
  
  
  <title>docker镜像制作并上传 - Fly542 技术沉淀</title>

  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4/dist/css/bootstrap.min.css" />


  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/github-markdown-css@4/github-markdown.min.css" />
  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/hint.css@2/hint.min.css" />

  
    
    
      
      <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/highlight.js@10/styles/github-gist.min.css" />
    
  

  
    <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3/dist/jquery.fancybox.min.css" />
  


<!-- 主题依赖的图标库，不要自行修改 -->

<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_ba1fz6golrf.css">



<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_lbnruvf0jn.css">


<link  rel="stylesheet" href="/css/main.css" />

<!-- 自定义样式保持在最底部 -->


  <script id="fluid-configs">
    var Fluid = window.Fluid || {};
    var CONFIG = {"hostname":"fly542.cn","root":"/","version":"1.8.14","typing":{"enable":true,"typeSpeed":70,"cursorChar":"_","loop":false},"anchorjs":{"enable":true,"element":"h1,h2,h3,h4,h5,h6","placement":"right","visible":"hover","icon":""},"progressbar":{"enable":true,"height_px":3,"color":"#29d","options":{"showSpinner":false,"trickleSpeed":100}},"copy_btn":true,"image_zoom":{"enable":true,"img_url_replace":["",""]},"toc":{"enable":true,"headingSelector":"h1,h2,h3,h4,h5,h6","collapseDepth":0},"lazyload":{"enable":true,"loading_img":"/img/loading.gif","onlypost":false,"offset_factor":2},"web_analytics":{"enable":false,"baidu":null,"google":null,"gtag":null,"tencent":{"sid":null,"cid":null},"woyaola":null,"cnzz":null,"leancloud":{"app_id":null,"app_key":null,"server_url":null,"path":"window.location.pathname","ignore_local":false}},"search_path":"/local-search.xml"};
  </script>
  <script  src="/js/utils.js" ></script>
  <script  src="/js/color-schema.js" ></script>
<meta name="generator" content="Hexo 6.0.0"></head>


<body>
  <header style="height: 70vh;">
    <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand" href="/">
      <strong>Fly542 技术沉淀</strong>
    </a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/">
                <i class="iconfont icon-home-fill"></i>
                首页
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/archives/">
                <i class="iconfont icon-archive-fill"></i>
                归档
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/categories/">
                <i class="iconfont icon-category-fill"></i>
                分类
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/tags/">
                <i class="iconfont icon-tags-fill"></i>
                标签
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/about/">
                <i class="iconfont icon-user-fill"></i>
                关于
              </a>
            </li>
          
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" target="_self" href="javascript:;" data-toggle="modal" data-target="#modalSearch" aria-label="Search">
              &nbsp;<i class="iconfont icon-search"></i>&nbsp;
            </a>
          </li>
        
        
          <li class="nav-item" id="color-toggle-btn">
            <a class="nav-link" target="_self" href="javascript:;" aria-label="Color Toggle">&nbsp;<i
                class="iconfont icon-dark" id="color-toggle-icon"></i>&nbsp;</a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

    <div class="banner" id="banner" parallax=true
         style="background: url('/img/default.png') no-repeat center center;
           background-size: cover;">
      <div class="full-bg-img">
        <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
          <div class="page-header text-center fade-in-up">
            <span class="h2" id="subtitle" title="docker镜像制作并上传">
              
            </span>

            
              <div class="mt-3">
  
  
    <span class="post-meta">
      <i class="iconfont icon-date-fill" aria-hidden="true"></i>
      <time datetime="2023-12-06 15:59" pubdate>
        2023年12月6日 下午
      </time>
    </span>
  
</div>

<div class="mt-1">
  
    <span class="post-meta mr-2">
      <i class="iconfont icon-chart"></i>
      8.6k 字
    </span>
  

  
    <span class="post-meta mr-2">
      <i class="iconfont icon-clock-fill"></i>
      
      
      72 分钟
    </span>
  

  
  
</div>

            
          </div>

          
        </div>
      </div>
    </div>
  </header>

  <main>
    
      

<div class="container-fluid nopadding-x">
  <div class="row nomargin-x">
    <div class="d-none d-lg-block col-lg-2"></div>
    <div class="col-lg-8 nopadding-x-md">
      <div class="container nopadding-x-md" id="board-ctn">
        <div class="py-5" id="board">
          <article class="post-content mx-auto">
            <!-- SEO header -->
            <h1 style="display: none">docker镜像制作并上传</h1>
            
            <div class="markdown-body">
              <h1 id="一、-Linux-版从-dockerfile-制作-Docker-镜像"><a href="#一、-Linux-版从-dockerfile-制作-Docker-镜像" class="headerlink" title="一、 Linux 版从 dockerfile 制作 Docker 镜像"></a>一、 Linux 版从 dockerfile 制作 Docker 镜像</h1><p>制作linux版的docker镜像需要一些准备工作，然后编写对应的dockerfile， 执行dockerfile 、推送镜像到服务端</p>
<h2 id="1-准备工作"><a href="#1-准备工作" class="headerlink" title="1. 准备工作"></a>1. 准备工作</h2><h3 id="1-1-准备好可访问外网的虚拟机，并安docker等软件"><a href="#1-1-准备好可访问外网的虚拟机，并安docker等软件" class="headerlink" title="1.1 准备好可访问外网的虚拟机，并安docker等软件"></a>1.1 准备好可访问外网的虚拟机，并安docker等软件</h3><figure class="highlight vala"><table><tr><td class="gutter"><div class="code-wrapper"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></div></td><td class="code"><pre><code class="hljs vala"><span class="hljs-meta"># 安装</span><br>yum install -y docker<br>yum install -y git<br><span class="hljs-meta"># 启动</span><br>systemctl start docker.service<br><span class="hljs-meta"># 显示docker 版本</span><br>docker --version<br><span class="hljs-comment">// Docker version 19.03.12, build dd074a9</span><br></code></pre></td></tr></table></figure>

<h3 id="1-2-登录docker"><a href="#1-2-登录docker" class="headerlink" title="1.2 登录docker"></a>1.2 登录docker</h3><figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><code class="hljs xml">docker login docker-registry.qqqqq.virtual<br><span class="hljs-tag">&lt;<span class="hljs-name">username</span>&gt;</span>: xxxxx<br><span class="hljs-tag">&lt;<span class="hljs-name">passwd</span>&gt;</span>: xxxxx<br></code></pre></td></tr></table></figure>

<h3 id="1-3-拉取依赖的基础镜像"><a href="#1-3-拉取依赖的基础镜像" class="headerlink" title="1.3 拉取依赖的基础镜像"></a>1.3 拉取依赖的基础镜像</h3><figure class="highlight apache"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs apache"><span class="hljs-attribute">docker</span> pull docker-registry.qqqqq.virtual/library/centos<span class="hljs-number">7</span>:<span class="hljs-number">7</span>-iqqqqq-<span class="hljs-number">13</span><br></code></pre></td></tr></table></figure>

<h3 id="1-4-部署andriod编译依赖的gradle工具"><a href="#1-4-部署andriod编译依赖的gradle工具" class="headerlink" title="1.4. 部署andriod编译依赖的gradle工具"></a>1.4. 部署andriod编译依赖的gradle工具</h3><p>通过 <a target="_blank" rel="noopener" href="https://gradle.org/releases/">https://gradle.org/releases/</a> 下载4.10.1版二进制包 </p>
<figure class="highlight awk"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><code class="hljs awk"><span class="hljs-comment"># 获取二进制包</span><br>wget https:<span class="hljs-regexp">//</span>services.gradle.org<span class="hljs-regexp">/distributions/g</span>radle-<span class="hljs-number">4.10</span>.<span class="hljs-number">1</span>-bin.zip<br><span class="hljs-comment"># 解压</span><br>unzip gradle-<span class="hljs-number">4.10</span>.<span class="hljs-number">1</span>-bin.zip<br>mkdir -p <span class="hljs-regexp">/opt/</span>soft<span class="hljs-regexp">/android/g</span>radle<br><span class="hljs-comment"># 将gradle拷贝到指定路径下</span><br>mv gradle-<span class="hljs-number">4.10</span>.<span class="hljs-number">1</span> <span class="hljs-regexp">/opt/</span>soft<span class="hljs-regexp">/android/g</span>radle<br></code></pre></td></tr></table></figure>

<h3 id="1-5-部署-andriod-编译依赖的NDK工具"><a href="#1-5-部署-andriod-编译依赖的NDK工具" class="headerlink" title="1.5. 部署 andriod 编译依赖的NDK工具"></a>1.5. 部署 andriod 编译依赖的NDK工具</h3><p>NDK的安装是通过 sdkmanager 来安装的，而 sdkmanager 包含在 commandlinetools 包中的，Android Studio 包含了commandlinetools工具，因为不需要图形化界面所以在<code>Command line tools only</code>标题下只下载linux版的 commandlinetools 就好了，不用下载完整的<code>Android Studio </code>。</p>
<p><a target="_blank" rel="noopener" href="https://developer.android.com/studio#downloads">https://developer.android.com/studio#downloads</a></p>
<h4 id="1-5-1-部署-commandlinetools-及其依赖"><a href="#1-5-1-部署-commandlinetools-及其依赖" class="headerlink" title="1.5.1 部署 commandlinetools 及其依赖"></a>1.5.1 部署 commandlinetools 及其依赖</h4><figure class="highlight awk"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><code class="hljs awk"><span class="hljs-comment"># sdkmanager 依赖java开发包，所以先安装java开发包</span><br>yum install java-<span class="hljs-number">1.8</span>.<span class="hljs-number">0</span>-openjdk-devel.x86_64 -y<br><span class="hljs-comment"># 解压</span><br>unzip commandlinetools-linux-<span class="hljs-number">7583922</span>_latest.zip<br>mkdir -p <span class="hljs-regexp">/opt/</span>soft<span class="hljs-regexp">/android/</span>sdk<span class="hljs-regexp">/cmdline-tools/</span><br><span class="hljs-comment"># 必须为latest目录，否则执行sdkmanager会报错，要求设置</span><br>mv cmdline-tools<span class="hljs-regexp">/ /</span>opt<span class="hljs-regexp">/soft/</span>android<span class="hljs-regexp">/sdk/</span>cmdline-tools/latest<br></code></pre></td></tr></table></figure>

<h4 id="1-5-2-设置环境变量"><a href="#1-5-2-设置环境变量" class="headerlink" title="1.5.2 设置环境变量"></a>1.5.2 设置环境变量</h4><p>因为 sdkmanager 的执行依赖部分环境变量，所以需要提前设置<br>vim ~/.bash_profile 添加以下内容：</p>
<figure class="highlight awk"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><code class="hljs awk">export ANDROID_SDK_ROOT=<span class="hljs-regexp">/opt/</span>soft<span class="hljs-regexp">/android/</span>sdk<br>export ANDROID_HOME=<span class="hljs-variable">$&#123;ANDROID_SDK_ROOT&#125;</span><br>export GRADLE_HOME=<span class="hljs-regexp">/opt/</span>soft<span class="hljs-regexp">/android/g</span>radle/gradle-<span class="hljs-number">4</span>\.<span class="hljs-number">10</span>\.<span class="hljs-number">1</span><br>PATH=<span class="hljs-variable">$PATH</span>:<span class="hljs-variable">$HOME</span><span class="hljs-regexp">/bin:$ANDROID_HOME/</span>tools:<span class="hljs-variable">$ANDROID_HOME</span><span class="hljs-regexp">/platform-tools:$GRADLE_HOME/</span>bin<br></code></pre></td></tr></table></figure>
<p><a target="_blank" rel="noopener" href="https://developer.android.com/studio/command-line/sdkmanager">官方文档</a>中说不设置ANDROID_HOME也可以,为了减少不必要的麻烦，设置上也没问题</p>
<p>执行以下命令使环境变量生效</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash"><span class="hljs-built_in">source</span> ~/.bash_profile<br></code></pre></td></tr></table></figure>

<h4 id="1-5-3-验证commandlinetools-部署"><a href="#1-5-3-验证commandlinetools-部署" class="headerlink" title="1.5.3 验证commandlinetools 部署"></a>1.5.3 验证commandlinetools 部署</h4><figure class="highlight awk"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><code class="hljs awk">cd <span class="hljs-regexp">/opt/</span>soft<span class="hljs-regexp">/android/</span>sdk<span class="hljs-regexp">/cmdline-tools/</span>latest/bin<br><span class="hljs-comment"># 成功显示版本号说明 commandlinetools</span><br>./sdkmanager --version<br></code></pre></td></tr></table></figure>

<h4 id="1-5-4-通过-sdkmanager-安装指定版本的NDK"><a href="#1-5-4-通过-sdkmanager-安装指定版本的NDK" class="headerlink" title="1.5.4 通过 sdkmanager 安装指定版本的NDK"></a>1.5.4 通过 sdkmanager 安装指定版本的NDK</h4><p>sdkmanager的应用参考《<a target="_blank" rel="noopener" href="https://developer.android.com/studio/command-line/sdkmanager">官方文档</a>》<br>常规用法如下：</p>
<figure class="highlight jboss-cli"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><code class="hljs jboss-cli"><span class="hljs-comment"># 显示可通过sdkmanager安装的软件包或已经安装的软件包,其中--channel后的数值 0 (stable), 1 (beta), 2 (dev), or 3 (canary)</span><br><span class="hljs-string">./sdkmanager</span> <span class="hljs-params">--list</span> <span class="hljs-params">--channel=0</span><br><span class="hljs-comment"># CMake 或 NDK，请使用以下语法：</span><br>sdkmanager <span class="hljs-params">--install</span><br>       [<span class="hljs-string">&quot;ndk;major.minor.build[suffix]&quot;</span> | <span class="hljs-string">&quot;cmake;major.minor.micro.build&quot;</span>]<br>       [<span class="hljs-params">--channel=channel_id</span>] <span class="hljs-string">//</span> NDK channels: 0 <span class="hljs-params">(stable)</span>, 1 <span class="hljs-params">(beta)</span>, or 3 <span class="hljs-params">(canary)</span><br></code></pre></td></tr></table></figure>
<p>执行以下命令安装需要的ndk20版</p>
<figure class="highlight jboss-cli"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><code class="hljs jboss-cli"><span class="hljs-comment"># 安装ndk20.1.5948944版</span><br><span class="hljs-string">./sdkmanager</span> <span class="hljs-params">--install</span> <span class="hljs-string">&quot;ndk;20.1.5948944&quot;</span> <span class="hljs-params">--channel=0</span><br><span class="hljs-comment"># 下一步将显示软件许可协议，输入 y 即可,然后等待下载完毕</span><br><span class="hljs-comment"># 下载完毕后将会在/opt/soft/android/sdk下自动创建licenses、ndk、patcher 等目录</span><br></code></pre></td></tr></table></figure>
<p>执行以下命令安装需要的cmake3.10.2版</p>
<figure class="highlight gradle"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs gradle"># 执行完毕后将在<span class="hljs-regexp">/opt/</span>soft<span class="hljs-regexp">/android/</span>sdk下自动创建cmake目录<br>./sdkmanager --install <span class="hljs-string">&quot;cmake;3.10.2.4988404&quot;</span>  --channel=<span class="hljs-number">0</span><br></code></pre></td></tr></table></figure>

<h3 id="1-6-通过-gradle-编译mydns"><a href="#1-6-通过-gradle-编译mydns" class="headerlink" title="1.6. 通过 gradle 编译mydns"></a>1.6. 通过 gradle 编译mydns</h3><p>此步骤目的主要是执行gradle 编译指令，由gradle自动获取编译mydns时需要的各种依赖工具，相关的依赖工具内容会存储在当前用户根目录的.gradle目录下，后面需要把这些依赖工具打到制作的docker镜像中</p>
<h4 id="1-6-1-拉取-mydns-代码"><a href="#1-6-1-拉取-mydns-代码" class="headerlink" title="1.6.1 拉取 mydns 代码"></a>1.6.1 拉取 mydns 代码</h4><p>此内容只适合与首次获取代码</p>
<figure class="highlight awk"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><code class="hljs awk">git clone ssh:<span class="hljs-regexp">//gi</span>t@gitlab.qqqqq.domain:<span class="hljs-number">10022</span><span class="hljs-regexp">/edge-cloud/my</span>dns.git <br>cd mydns<br>git submodule update --init --recursive<br></code></pre></td></tr></table></figure>
<h4 id="1-6-2-通过-gradle-编译mydns及其依赖的子项目"><a href="#1-6-2-通过-gradle-编译mydns及其依赖的子项目" class="headerlink" title="1.6.2 通过 gradle 编译mydns及其依赖的子项目"></a>1.6.2 通过 gradle 编译mydns及其依赖的子项目</h4><h5 id="1-6-2-1替换gradle编译时依赖的sdk-dir和ndk-dir目录"><a href="#1-6-2-1替换gradle编译时依赖的sdk-dir和ndk-dir目录" class="headerlink" title="1.6.2.1替换gradle编译时依赖的sdk.dir和ndk.dir目录"></a>1.6.2.1替换gradle编译时依赖的sdk.dir和ndk.dir目录</h5><figure class="highlight awk"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><code class="hljs awk">echo -e <span class="hljs-string">&quot;sdk.dir=$&#123;ANDROID_SDK_ROOT&#125;\nndk.dir=$&#123;ANDROID_SDK_ROOT&#125;/ndk/20.1.5948944&quot;</span> &gt; .<span class="hljs-regexp">/third-party/</span>acl<span class="hljs-regexp">/android/</span>acl_c++_shared/local.properties<br>echo -e <span class="hljs-string">&quot;sdk.dir=$&#123;ANDROID_SDK_ROOT&#125;\nndk.dir=$&#123;ANDROID_SDK_ROOT&#125;/ndk/20.1.5948944&quot;</span> &gt; .<span class="hljs-regexp">/third-party/m</span>bedtls-<span class="hljs-number">2.7</span>.<span class="hljs-number">12</span><span class="hljs-regexp">/android/m</span>bedtls_c++shared/local.properties<br>echo -e <span class="hljs-string">&quot;sdk.dir=$&#123;ANDROID_SDK_ROOT&#125;\nndk.dir=$&#123;ANDROID_SDK_ROOT&#125;/ndk/20.1.5948944&quot;</span> &gt; src<span class="hljs-regexp">/android/</span>dns_c++shared/local.properties<br></code></pre></td></tr></table></figure>

<h5 id="1-6-2-2-使用gradle-编译-acl"><a href="#1-6-2-2-使用gradle-编译-acl" class="headerlink" title="1.6.2.2 使用gradle 编译 acl"></a>1.6.2.2 使用gradle 编译 acl</h5><figure class="highlight awk"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><code class="hljs awk">cd .<span class="hljs-regexp">/third-party/</span>acl<span class="hljs-regexp">/android/</span>acl_c++_shared/<br><span class="hljs-comment"># 执行gradle编译</span><br>gradle build<br><span class="hljs-comment"># 执行完毕后回到mydns根目录</span><br>cd -<br></code></pre></td></tr></table></figure>

<h5 id="1-6-2-3-使用gradle-编译-mbedtls"><a href="#1-6-2-3-使用gradle-编译-mbedtls" class="headerlink" title="1.6.2.3 使用gradle 编译 mbedtls"></a>1.6.2.3 使用gradle 编译 mbedtls</h5><figure class="highlight awk"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><code class="hljs awk">cd third-party<span class="hljs-regexp">/mbedtls-2.7.12/</span>android<span class="hljs-regexp">/mbedtls_c++shared/</span><br><span class="hljs-comment"># 执行gradle编译</span><br>gradle build<br><span class="hljs-comment"># 执行完毕后回到mydns根目录</span><br>cd -<br></code></pre></td></tr></table></figure>

<h5 id="1-6-2-4-使用gradle-编译-libdns"><a href="#1-6-2-4-使用gradle-编译-libdns" class="headerlink" title="1.6.2.4 使用gradle 编译 libdns"></a>1.6.2.4 使用gradle 编译 libdns</h5><figure class="highlight awk"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><code class="hljs awk">cd src<span class="hljs-regexp">/android/</span>dns_c++shared<span class="hljs-regexp">/libdns/</span><br><span class="hljs-comment"># 执行gradle编译</span><br>gradle build<br><span class="hljs-comment"># 执行完毕后回到mydns根目录</span><br>cd -<br></code></pre></td></tr></table></figure>

<h5 id="1-6-2-5-使用gradle-编译-libqnet"><a href="#1-6-2-5-使用gradle-编译-libqnet" class="headerlink" title="1.6.2.5 使用gradle 编译 libqnet"></a>1.6.2.5 使用gradle 编译 libqnet</h5><figure class="highlight awk"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><code class="hljs awk">cd src<span class="hljs-regexp">/android/</span>dns_c++shared/libqnet<br><span class="hljs-comment"># 执行gradle编译</span><br>gradle build<br><span class="hljs-comment"># 执行完毕后回到mydns根目录</span><br>cd -<br></code></pre></td></tr></table></figure>

<h5 id="1-6-2-6-使用gradle-编译-mydns"><a href="#1-6-2-6-使用gradle-编译-mydns" class="headerlink" title="1.6.2.6 使用gradle 编译 mydns"></a>1.6.2.6 使用gradle 编译 mydns</h5><figure class="highlight awk"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><code class="hljs awk">cd src<span class="hljs-regexp">/android/</span>dns_c++shared/mydns<br><span class="hljs-comment"># 执行gradle编译</span><br>gradle build<br><span class="hljs-comment"># 执行完毕后回到mydns根目录</span><br>cd -<br></code></pre></td></tr></table></figure>

<h3 id="1-7-拷贝gradle缓存目录到docker-镜像制作目录"><a href="#1-7-拷贝gradle缓存目录到docker-镜像制作目录" class="headerlink" title="1.7 拷贝gradle缓存目录到docker 镜像制作目录"></a>1.7 拷贝gradle缓存目录到docker 镜像制作目录</h3><p>因为计划将dockerfile中的COPY命令的context设置在/opt/soft/android目录下，便于生成镜像时拷贝相关目录文件</p>
<figure class="highlight awk"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs awk">cp -r ~<span class="hljs-regexp">/.gradle /</span>opt<span class="hljs-regexp">/soft/</span>android<br></code></pre></td></tr></table></figure>

<h3 id="1-8-异常及解决方法"><a href="#1-8-异常及解决方法" class="headerlink" title="1.8 异常及解决方法"></a>1.8 异常及解决方法</h3><ul>
<li>编译 libdns 时  <figure class="highlight subunit"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><code class="hljs subunit">&gt; Task :libdns:lint FAILED<br><br><span class="hljs-keyword">FAILURE: </span>Build failed with an exception.<br><br>* What went wrong:<br>Execution failed for task &#x27;:libdns:lint&#x27;.<br>&gt; Could not resolve all artifacts for configuration &#x27;:libdns:debugAndroidTestRuntimeClasspath&#x27;.<br>&gt; Could not download hamcrest-core.jar (org.hamcrest:hamcrest-core:1.3)<br>	&gt; Could not get resource &#x27;https://jcenter.bintray.com/org/hamcrest/hamcrest-core/1.3/hamcrest-core<span class="hljs-string">-1</span>.3.jar&#x27;.<br>		&gt; Could not HEAD &#x27;https://jcenter.bintray.com/org/hamcrest/hamcrest-core/1.3/hamcrest-core<span class="hljs-string">-1</span>.3.jar&#x27;.<br>			&gt; Read timed out<br><br></code></pre></td></tr></table></figure>
  解决方法  <figure class="highlight awk"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><code class="hljs awk">方法<span class="hljs-number">1</span> 通过再次执行gradle build  有可能会下载成功<br>方法<span class="hljs-number">2</span> 修改当前目录下的build.gradle 文件，使用阿里镜像 未验证此方法<br>	参考 《[如何用gradle配置国内阿里云镜像源](https:<span class="hljs-regexp">//</span>blog.csdn.net<span class="hljs-regexp">/yizhuanlu9607/</span>article<span class="hljs-regexp">/details/</span><span class="hljs-number">96971042</span>)》<br></code></pre></td></tr></table></figure></li>
</ul>
<h2 id="2-编写-dockerfile"><a href="#2-编写-dockerfile" class="headerlink" title="2 编写 dockerfile"></a>2 编写 dockerfile</h2><p>vim /opt/soft/android/dockerfile 文件中的内容如下：</p>
<figure class="highlight awk"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><code class="hljs awk">FROM docker-registry.qqqqq.virtual<span class="hljs-regexp">/library/</span>centos7:<span class="hljs-number">7</span>-iqqqqq-<span class="hljs-number">13</span><br><br>RUN yum install -y java-<span class="hljs-number">1.8</span>.<span class="hljs-number">0</span>-openjdk-devel.x86_64 which git zip unzip <br><br>COPY .<span class="hljs-regexp">/gradle /</span>opt<span class="hljs-regexp">/soft/</span>android/gradle<br>COPY .<span class="hljs-regexp">/sdk /</span>opt<span class="hljs-regexp">/soft/</span>android/sdk<br>COPY <span class="hljs-regexp">/.gradle /</span>root/.gradle<br>ENV ANDROID_SDK_ROOT=<span class="hljs-regexp">/opt/</span>soft<span class="hljs-regexp">/android/</span>sdk<br>ENV ANDROID_HOME=<span class="hljs-variable">$ANDROID_SDK_ROOT</span><br>ENV GRADLE_HOME=<span class="hljs-regexp">/opt/</span>soft<span class="hljs-regexp">/android/g</span>radle/gradle-<span class="hljs-number">4</span>\.<span class="hljs-number">10</span>\.<span class="hljs-number">1</span><br>ENV PATH=<span class="hljs-variable">$PATH</span>:<span class="hljs-variable">$ANDROID_HOME</span><span class="hljs-regexp">/tools:$ANDROID_HOME/</span>platform-tools:<span class="hljs-variable">$GRADLE_HOME</span><span class="hljs-regexp">/bin:$ANDROID_SDK_ROOT/</span>ndk<span class="hljs-regexp">/20\.1\.5948944/</span>toolchains<span class="hljs-regexp">/aarch64-linux-android-4\.9/</span>prebuilt<span class="hljs-regexp">/linux-x86_64/</span>bin:<span class="hljs-variable">$ANDROID_SDK_ROOT</span><span class="hljs-regexp">/ndk/</span><span class="hljs-number">20</span>\.<span class="hljs-number">1</span>\.<span class="hljs-number">5948944</span><span class="hljs-regexp">/toolchains/</span>arm-linux-androideabi-<span class="hljs-number">4</span>\.<span class="hljs-number">9</span><span class="hljs-regexp">/prebuilt/</span>linux-x86_64<span class="hljs-regexp">/bin:$ANDROID_SDK_ROOT/</span>ndk<span class="hljs-regexp">/20\.1\.5948944/</span>toolchains<span class="hljs-regexp">/x86-4\.9/</span>prebuilt<span class="hljs-regexp">/linux-x86_64/</span>bin<br></code></pre></td></tr></table></figure>

<h2 id="3-根据-dockerfile-创建镜像"><a href="#3-根据-dockerfile-创建镜像" class="headerlink" title="3 根据 dockerfile 创建镜像"></a>3 根据 dockerfile 创建镜像</h2><ul>
<li>创建本地镜像</li>
</ul>
<figure class="highlight awk"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><code class="hljs awk">cd <span class="hljs-regexp">/opt/</span>soft<span class="hljs-regexp">/android/</span><br><span class="hljs-comment"># 创建镜像，最后的.不能少</span><br>docker build -t mydns_linux_base:<span class="hljs-number">1.0</span> .<br><span class="hljs-comment"># 查看创建的镜像 mydns_linux_base 版本为1.0</span><br>docker images <br></code></pre></td></tr></table></figure>

<ul>
<li>根据新的本地镜像创建一个容器,并验证环境变量和目录的正确性<figure class="highlight ruby"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs ruby">docker run --name test_mydns -it -v <span class="hljs-string">`pwd`</span><span class="hljs-symbol">:/root/workspace</span> --privileged=<span class="hljs-literal">true</span> <span class="hljs-symbol">mydns_linux_base:</span><span class="hljs-number">1.0</span> /bin/bash<br></code></pre></td></tr></table></figure></li>
</ul>
<h2 id="4-将创建的镜像推送到远端仓库中"><a href="#4-将创建的镜像推送到远端仓库中" class="headerlink" title="4 将创建的镜像推送到远端仓库中"></a>4 将创建的镜像推送到远端仓库中</h2><h3 id="4-1-创建标签并推送到远端仓库中"><a href="#4-1-创建标签并推送到远端仓库中" class="headerlink" title="4.1 创建标签并推送到远端仓库中"></a>4.1 创建标签并推送到远端仓库中</h3><figure class="highlight apache"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><code class="hljs apache"><span class="hljs-comment"># 查看新创建的mydns_linux_base本地镜像的id</span><br><span class="hljs-attribute">docker</span> images --filter=reference=&#x27;mydns_linux_base:*&#x27;<br><span class="hljs-comment"># 必须创建新的标签，才能push 到远端。</span><br><span class="hljs-comment"># 如要推送的路径是docker-registry.qqqqq.virtual/edge-cloud/mydns_linux_base 的1.0版，则需要先创建以下标签</span><br><span class="hljs-attribute">docker</span> tag f<span class="hljs-number">234786</span>cc<span class="hljs-number">5</span>f<span class="hljs-number">9</span> docker-registry.qqqqq.virtual/edge-cloud/mydns_linux_base:<span class="hljs-number">1</span>.<span class="hljs-number">0</span><br><span class="hljs-comment"># 推送到仓库 docker-registry.qqqqq.virtual/edge-cloud/mydns_linux_base 下 标签为1.0</span><br><span class="hljs-attribute">docker</span> push docker-registry.qqqqq.virtual/edge-cloud/mydns_linux_base:<span class="hljs-number">1</span>.<span class="hljs-number">0</span><br></code></pre></td></tr></table></figure>
<h3 id="4-2-推送镜像查看"><a href="#4-2-推送镜像查看" class="headerlink" title="4.2 推送镜像查看"></a>4.2 推送镜像查看</h3><p>打开 以下网址查看是否有新推的 mydns_linux_base 镜像<br><a target="_blank" rel="noopener" href="http://qae.cloud.qqqqq.domain/registry/namespaces/?filter_text=undefined:edge-cloud">http://qae.cloud.qqqqq.domain/registry/namespaces/?filter_text=undefined:edge-cloud</a></p>
<h3 id="4-3-本地清理及使用获取远端仓库镜像"><a href="#4-3-本地清理及使用获取远端仓库镜像" class="headerlink" title="4.3 本地清理及使用获取远端仓库镜像"></a>4.3 本地清理及使用获取远端仓库镜像</h3><p>推送成功后可以将本地的 mydns_linux_base 进行删除</p>
<figure class="highlight apache"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><code class="hljs apache"><span class="hljs-comment"># 此时本地的 mydns_linux_base和docker-registry.qqqqq.virtual/edge-cloud/mydns_linux_base的id都是 f234786cc5f9</span><br><span class="hljs-comment"># 无法通过 以下命令直接删除</span><br><span class="hljs-attribute">docker</span> rmi f<span class="hljs-number">234786</span>cc<span class="hljs-number">5</span>f<span class="hljs-number">9</span> <br><span class="hljs-comment"># 应该先删除docker tag改名前的镜像，使用镜像名称删除，（一般在docker tag镜像改名后，最好删除改名前的镜像</span><br><span class="hljs-attribute">docker</span> rmi docker-registry.qqqqq.virtual/edge-cloud/mydns_linux_base:<span class="hljs-number">1</span>.<span class="hljs-number">0</span><br><span class="hljs-comment"># 再执行删除 mydns_linux_base</span><br><span class="hljs-attribute">docker</span> rmi mydns_linux_base:<span class="hljs-number">1</span>.<span class="hljs-number">0</span> <br></code></pre></td></tr></table></figure>

<h3 id="4-4-异常及解决方法"><a href="#4-4-异常及解决方法" class="headerlink" title="4.4 异常及解决方法"></a>4.4 异常及解决方法</h3><ul>
<li>push时权限错误  <figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><code class="hljs yaml"><span class="hljs-string">The</span> <span class="hljs-string">push</span> <span class="hljs-string">refers</span> <span class="hljs-string">to</span> <span class="hljs-string">repository</span> [<span class="hljs-string">docker-registry.qqqqq.virtual/edge-cloud/mydns_linux_base</span>]<br><span class="hljs-attr">1885a8d3b104:</span> <span class="hljs-string">Preparing</span> <br><span class="hljs-attr">7e0dbba8fe17:</span> <span class="hljs-string">Preparing</span> <br><span class="hljs-attr">6bb0d2c98d31:</span> <span class="hljs-string">Preparing</span> <br><span class="hljs-attr">fd846adc3060:</span> <span class="hljs-string">Preparing</span> <br><span class="hljs-attr">41c37881aa1c:</span> <span class="hljs-string">Preparing</span> <br><span class="hljs-attr">edfc6fdcb211:</span> <span class="hljs-string">Preparing</span> <br><span class="hljs-attr">ddd02f1907f4:</span> <span class="hljs-string">Preparing</span> <br><span class="hljs-attr">a51dabe2037e:</span> <span class="hljs-string">Preparing</span> <br><span class="hljs-attr">129b697f70e9:</span> <span class="hljs-string">Preparing</span><br><span class="hljs-attr">error parsing HTTP 403 response body:</span> <span class="hljs-string">invalid</span> <span class="hljs-string">character</span> <span class="hljs-string">&#x27;T&#x27;</span> <span class="hljs-attr">looking for beginning of value:</span> <span class="hljs-string">&quot;The supplied authentication is not authorized to access this resource&quot;</span><br></code></pre></td></tr></table></figure>
  解决方法  <figure class="highlight vala"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><code class="hljs vala"><span class="hljs-meta"># 退出docker 当前登录用户，使用有权限的账号进行登录</span><br>docker logout docker-registry.qqqqq.<span class="hljs-keyword">virtual</span><br><span class="hljs-meta"># 从新登陆</span><br>docker login docker-registry.qqqqq.<span class="hljs-keyword">virtual</span><br><br>参考http:<span class="hljs-comment">//docker.gitlab.qqqqq.domain/readme/sample.html</span><br></code></pre></td></tr></table></figure>
<h1 id="二、-Linux-版从-container-制作-Docker-镜像"><a href="#二、-Linux-版从-container-制作-Docker-镜像" class="headerlink" title="二、 Linux 版从 container 制作 Docker 镜像"></a>二、 Linux 版从 container 制作 Docker 镜像</h1>使用以下命令可以从特定的container直接制作新的镜像</li>
</ul>
<p><code>docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]] </code></p>
<p>如: docker commit mycontainer myimage:v1.0</p>
<h1 id="三、Windows-版编译服务器设置"><a href="#三、Windows-版编译服务器设置" class="headerlink" title="三、Windows 版编译服务器设置"></a>三、Windows 版编译服务器设置</h1><h2 id="3-1-安装必要的依赖软件"><a href="#3-1-安装必要的依赖软件" class="headerlink" title="3.1 安装必要的依赖软件"></a>3.1 安装必要的依赖软件</h2><ol>
<li><p>安装vs2019、git、curl、7-Zip 到默认的c盘路径下</p>
</li>
<li><p>配置环境变量</p>
 <figure class="highlight taggerscript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><code class="hljs taggerscript">INCLUDE变量内容<br>C:<span class="hljs-symbol">\P</span>rogram Files (x86)<span class="hljs-symbol">\W</span>indows Kits<span class="hljs-symbol">\1</span>0<span class="hljs-symbol">\I</span>nclude<span class="hljs-symbol">\1</span>0.0.19041.0<span class="hljs-symbol">\s</span>hared<br>C:<span class="hljs-symbol">\P</span>rogram Files (x86)<span class="hljs-symbol">\W</span>indows Kits<span class="hljs-symbol">\1</span>0<span class="hljs-symbol">\I</span>nclude<span class="hljs-symbol">\1</span>0.0.19041.0<span class="hljs-symbol">\u</span>crt<br>C:<span class="hljs-symbol">\P</span>rogram Files (x86)<span class="hljs-symbol">\W</span>indows Kits<span class="hljs-symbol">\1</span>0<span class="hljs-symbol">\I</span>nclude<span class="hljs-symbol">\1</span>0.0.19041.0<span class="hljs-symbol">\u</span>m<br>C:<span class="hljs-symbol">\P</span>rogram Files (x86)<span class="hljs-symbol">\W</span>indows Kits<span class="hljs-symbol">\1</span>0<span class="hljs-symbol">\I</span>nclude<span class="hljs-symbol">\1</span>0.0.19041.0<span class="hljs-symbol">\w</span>inrt<br>C:<span class="hljs-symbol">\P</span>rogram Files (x86)<span class="hljs-symbol">\M</span>icrosoft Visual Studio<span class="hljs-symbol">\2</span>019<span class="hljs-symbol">\C</span>ommunity<span class="hljs-symbol">\V</span>C<span class="hljs-symbol">\T</span>ools<span class="hljs-symbol">\M</span>SVC<span class="hljs-symbol">\1</span>4.29.30037<span class="hljs-symbol">\i</span>nclude<br><br>LIB变量内容<br>C:<span class="hljs-symbol">\P</span>rogram Files (x86)<span class="hljs-symbol">\M</span>icrosoft Visual Studio<span class="hljs-symbol">\2</span>019<span class="hljs-symbol">\C</span>ommunity<span class="hljs-symbol">\V</span>C<span class="hljs-symbol">\T</span>ools<span class="hljs-symbol">\M</span>SVC<span class="hljs-symbol">\1</span>4.29.30037<span class="hljs-symbol">\l</span>ib<span class="hljs-symbol">\x</span>86<br>C:<span class="hljs-symbol">\P</span>rogram Files (x86)<span class="hljs-symbol">\W</span>indows Kits<span class="hljs-symbol">\1</span>0<span class="hljs-symbol">\L</span>ib<span class="hljs-symbol">\1</span>0.0.19041.0<span class="hljs-symbol">\u</span>crt<span class="hljs-symbol">\x</span>86<br>C:<span class="hljs-symbol">\P</span>rogram Files (x86)<span class="hljs-symbol">\W</span>indows Kits<span class="hljs-symbol">\1</span>0<span class="hljs-symbol">\L</span>ib<span class="hljs-symbol">\1</span>0.0.19041.0<span class="hljs-symbol">\u</span>m<span class="hljs-symbol">\x</span>86<br><br>PATH变量内容<br>C:<span class="hljs-symbol">\U</span>sers<span class="hljs-symbol">\c</span>loudbase-init<span class="hljs-symbol">\c</span>url<span class="hljs-symbol">\c</span>url-7.76.1-win64-mingw<span class="hljs-symbol">\b</span>in<br>C:<span class="hljs-symbol">\P</span>rogram Files (x86)<span class="hljs-symbol">\M</span>icrosoft Visual Studio<span class="hljs-symbol">\2</span>019<span class="hljs-symbol">\C</span>ommunity<span class="hljs-symbol">\M</span>SBuild<span class="hljs-symbol">\C</span>urrent<span class="hljs-symbol">\B</span>in<br>C:<span class="hljs-symbol">\P</span>rogram Files (x86)<span class="hljs-symbol">\M</span>icrosoft Visual Studio<span class="hljs-symbol">\2</span>019<span class="hljs-symbol">\C</span>ommunity<span class="hljs-symbol">\V</span>C<span class="hljs-symbol">\T</span>ools<span class="hljs-symbol">\M</span>SVC<span class="hljs-symbol">\1</span>4.29.30037<span class="hljs-symbol">\b</span>in<span class="hljs-symbol">\H</span>ostx86<span class="hljs-symbol">\x</span>86<br>C:<span class="hljs-symbol">\P</span>rogram Files<span class="hljs-symbol">\G</span>it<span class="hljs-symbol">\c</span>md<br>C:<span class="hljs-symbol">\P</span>rogram Files<span class="hljs-symbol">\7</span>-Zip<br></code></pre></td></tr></table></figure></li>
<li><p>生成本机的sshkey<br> 因为在部署git的时候已经默认安装了ssh-keygen工具，所以直接在命令窗口执行ssh-keygen工具生成本机的ssh秘钥即可</p>
</li>
<li><p>在mydns项目中添加本机的sshkey<br> 将上一步生成的公钥添加到 mydns/settings/repository 下的 <code>Deploy Keys</code> 中即可</p>
</li>
</ol>

            </div>
            <hr>
            <div>
              <div class="post-metas mb-3">
                
                  <div class="post-meta mr-3">
                    <i class="iconfont icon-category"></i>
                    
                      <a class="hover-with-bg" href="/categories/devops/">devops</a>
                    
                  </div>
                
                
                  <div class="post-meta">
                    <i class="iconfont icon-tags"></i>
                    
                      <a class="hover-with-bg" href="/tags/linux/">linux</a>
                    
                  </div>
                
              </div>
              
                <p class="note note-warning">
                  
                    本博客所有文章除特别声明外，均采用 <a target="_blank" href="https://creativecommons.org/licenses/by-sa/4.0/deed.zh" rel="nofollow noopener noopener">CC BY-SA 4.0 协议</a> ，转载请注明出处！
                  
                </p>
              
              
                <div class="post-prevnext">
                  <article class="post-prev col-6">
                    
                    
                      <a href="/2023/12/06/04DevOps/31docker%E9%95%9C%E5%83%8F%E7%9A%84%E5%AF%BC%E5%85%A5%E5%92%8C%E5%AF%BC%E5%87%BA/">
                        <i class="iconfont icon-arrowleft"></i>
                        <span class="hidden-mobile">docker镜像的导入和导出</span>
                        <span class="visible-mobile">上一篇</span>
                      </a>
                    
                  </article>
                  <article class="post-next col-6">
                    
                    
                      <a href="/2023/11/29/00%E7%AE%97%E6%B3%95%E4%B8%8E%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84/07%E5%AD%97%E5%85%B8%E6%A0%91%E7%9A%84%E5%87%A0%E7%A7%8D%E5%AE%9E%E7%8E%B0%E6%96%B9%E5%BC%8F%E4%BB%A5%E5%8F%8A%E5%BA%94%E7%94%A8(%E8%BD%AC%E8%BD%BD)/">
                        <span class="hidden-mobile">字典树的几种实现方式以及应用(转载)</span>
                        <span class="visible-mobile">下一篇</span>
                        <i class="iconfont icon-arrowright"></i>
                      </a>
                    
                  </article>
                </div>
              
            </div>

            
          </article>
        </div>
      </div>
    </div>
    
      <div class="d-none d-lg-block col-lg-2 toc-container" id="toc-ctn">
        <div id="toc">
  <p class="toc-header"><i class="iconfont icon-list"></i>&nbsp;目录</p>
  <div class="toc-body" id="toc-body"></div>
</div>

      </div>
    
  </div>
</div>

<!-- Custom -->


    

    
      <a id="scroll-top-button" aria-label="TOP" href="#" role="button">
        <i class="iconfont icon-arrowup" aria-hidden="true"></i>
      </a>
    

    
      <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">搜索</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v"
                 for="local-search-input">关键词</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>
    

    
  </main>

  <footer class="text-center mt-5 py-3">
  <div class="footer-content">
     <a href="https://hexo.io" target="_blank" rel="nofollow noopener"><span>Hexo</span></a> <i class="iconfont icon-love"></i> <a href="https://github.com/fluid-dev/hexo-theme-fluid" target="_blank" rel="nofollow noopener"><span>Fluid</span></a> 
  </div>
  

  

  
</footer>


  <!-- SCRIPTS -->
  
  <script  src="https://cdn.jsdelivr.net/npm/nprogress@0/nprogress.min.js" ></script>
  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/nprogress@0/nprogress.min.css" />

  <script>
    NProgress.configure({"showSpinner":false,"trickleSpeed":100})
    NProgress.start()
    window.addEventListener('load', function() {
      NProgress.done();
    })
  </script>


<script  src="https://cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js" ></script>
<script  src="https://cdn.jsdelivr.net/npm/bootstrap@4/dist/js/bootstrap.min.js" ></script>
<script  src="/js/events.js" ></script>
<script  src="/js/plugins.js" ></script>

<!-- Plugins -->


  <script  src="/js/local-search.js" ></script>



  
    <script  src="/js/img-lazyload.js" ></script>
  



  



  
    <script  src="https://cdn.jsdelivr.net/npm/tocbot@4/dist/tocbot.min.js" ></script>
  
  
    <script  src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3/dist/jquery.fancybox.min.js" ></script>
  
  
    <script  src="https://cdn.jsdelivr.net/npm/anchor-js@4/anchor.min.js" ></script>
  
  
    <script defer src="https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js" ></script>
  






  <script  src="https://cdn.jsdelivr.net/npm/typed.js@2/lib/typed.min.js" ></script>
  <script>
    (function (window, document) {
      var typing = Fluid.plugins.typing;
      var title = document.getElementById('subtitle').title;
      
        typing(title);
      
    })(window, document);
  </script>















<!-- 主题的启动项 保持在最底部 -->
<script  src="/js/boot.js" ></script>


</body>
</html>
